
package com.insigma.business.qrcode.common.util;

import org.apache.commons.lang3.StringUtils;


public enum ConsumerCodeEnum {


    SUCCESS("0", "处理成功"),

    /** 处理成功 */
    UNAUTHORIZED("401", "处理成功"),


    PARAM_NULL("81214001", "参数为空"),


    ILLEGAL_PARAM("81214002", "参数非法"),





    UNKNOWN_EXCEPTION("81211000", "未知异常"),


    DATABASE_EXCEPTION("81211001", "数据库异常"),


    REFLECT_EXCEPTION("81211002", "反射异常"),


    INTERNAL_ERROR("81211003", "系统内部错误"),
    ;

    ConsumerCodeEnum(final String code, final String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static ConsumerCodeEnum getByEnumCode(final String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }

        /*if(MSDFErrorCodeEnum.getByCode(code)!=null){
            return INTERNAL_ERROR;
        }*/

        for (ConsumerCodeEnum element : values()) {
            if (StringUtils.equals(element.getCode(), code)) {
                return element;
            }
        }
        return null;
    }


    private String code;


    private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

}
